package cn.passlink.www.Mapper;

import cn.passlink.www.Enity.Article;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

//操纵数据库
@Mapper
@Repository
public interface ArticleDao {

  //数据总量
  Integer getCounts();
  Integer getCommentsCounts(String article_id);
  void updateCommentsCounts(String article_id);
  Integer getCommentsCountsByArticleId(String article_id);
  //分页普通查询
  List<Article> findPage(Integer start_index,Integer page_size);

//   <!--关键词普通查询-->
  List<Article> findPageByKey(Integer start_index,Integer page_size,String key_words);
  int findPageByKeyCounts(String key_words);
  //按标签分类查找
  List<Article> findPageByTag( Integer start_index,Integer page_size,String tags);
  int findPageByTagCounts(String tags );
  //按标签分类和关键词查找
  List<Article>   findPageByTagKey( Integer start_index,Integer page_size,String tags,String key_words);
  int findPageByTagKeyCounts(String tags,String key_words);
  //按种类分类查找
  List<Article> findPageByType( Integer start_index,Integer page_size,String type);
  int findPageByTypeCounts(String type );
  //按种类分类和关键词查找
  List<Article>   findPageByTypeKey( Integer start_index,Integer page_size,String type,String key_words);
  int findPageByTypeKeyCounts( String  type,String key_words );
//   List<Article> findAll();
  Article findById(String article_id);

  List<Article> findByTypeTags(String type, String tags);

  void pullArticle(Article article);

  void updateArticle(Article article);

  List<Article> findByTime();

  boolean delArticle(String article_id);

  String findUserIdByArticleId (String article_id);
//  关系更新
  void pullUserID(String user_id, String article_id);

  List<Article>  findAllByUserId(String user_id);

  void updateViews(String article_id);
}
